
package com.bjypc.youth.dao;

import java.util.List;

import com.bjypc.youth.common.PageResult;
import com.bjypc.youth.common.QueryCriteria;


@SuppressWarnings("unchecked")
public interface IDao<T>
{
	/**
	 * 
	 * @param o
	 */
	public void save(T o);

	/**
	 * 
	 * @param o
	 */
	public void update(T o);

	/**
	 * 
	 * @param o
	 */
	public void remove(T o);

	/**
	 * 
	 * @param id
	 */
	public void removeById(Long id);

	/**
	 * 
	 * @param clazz
	 * @param id
	 */
	public void removeById(Class clazz, Long id);

	/**
	 * 
	 * @return
	 */
	public List<T> findAll();

	/**
	 * 
	 * @param id
	 * @return
	 */
	public T findById(Long id);

	/**
	 * 
	 * @param clazz
	 * @param id
	 * @return
	 */
	public T findById(Class clazz, Long id);

	/**
	 * 
	 * @param hql
	 * @param paramValues
	 * @return
	 */
	public List find(String jpaql, Object... paramValues);

	/**
	 * 
	 * @param hql
	 * @param paramValueList
	 * @return
	 */
	public List find(String jpaql, List paramValueList);

	/**
	 * 
	 * @param queryName
	 * @param paramValues
	 * @return
	 */
	public List namedQuery(String queryName, Object... paramValues);

	/**
	 * 
	 * @param queryName
	 * @param paramValueList
	 * @return
	 */
	public List namedQuery(String queryName, List paramValueList);

	/**
	 * 
	 * @param sql
	 * @param paramValues
	 * @return
	 */
	public List nativeQuery(String sql, Object... paramValues);

	/**
	 * 
	 * @param sql
	 * @param paramValueList
	 * @return
	 */
	public List nativeQuery(String sql, List paramValueList);

	/**
	 * 
	 * @param hql
	 * @param criteria
	 * @return
	 */
	public PageResult query(String jpaql, QueryCriteria criteria);

}